package com.course.service.impl;

import com.course.dao.PlanMapper;
import com.course.pojo.Plan;
import com.course.service.PlanService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

@Service
public class PlanServiceimpl implements PlanService{
    private PlanMapper planmapper;

    @Override
    public int deleteByPrimaryKey(String planid) {
        return planmapper.deleteByPrimaryKey(planid);
    }

    @Override
    public int insert(Plan record) {
        return planmapper.insert(record);
    }

    @Override
    public int insertSelective(Plan record) {
        return planrmapper.insertSelective(record);
    }

    @Override
    public String selectByPrimaryKey(String planid) {
        return planmapper.selectByPrimaryKey(planid);
    }

    @Override
    public int updateByPrimaryKeySelective(Plan record) {
        return planmapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Plan record) {
        return planmapper.updateByPrimaryKey(record);
    }

    @Override
    public String addPlan(String planid)
    {
        Plan plan = new Plan();
        plan.setPlanid(planid);
        int i = planMapper.updateByPrimaryKeySelective(plan);
        if(i==1){
            return "200";
        }
        return "400";
    }

    @Override
    public String deletePlan(String planid)
    {
        Plan plan = new Plan();
        plan.setPlanid(planid);
        int i = planMapper.selectByPrimaryKey(planid);
        if(i==1){
            int j = planMapper.deleteByPrimaryKey(planid);
            return "200";
        }
        return "400";
    }

}